package org.ydsw.data.manage.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.ydsw.data.manage.entity.DataManageStandardEntity;

import java.util.List;

public interface DataManageStandardEntityMapper {
    //查询已有的标准类型
    @Select("SELECT DISTINCT(standard_type) as standard_type_list from data_manage_standard")
    @Results(
            id = "standard_type",
            value = {
                    @Result(property = "standardType",column = "standard_type_list"),
            }
    )
    List<DataManageStandardEntity> selectDataManageStandardType();





    //查询已有的标准
    @Select("select * from data_manage_standard")
    @Results(
            id = "standard",
            value = {
                    @Result(property = "fieldName",column = "field_name"),
                    @Result(property = "contentStandard",column = "content_standard"),
                    @Result(property = "qualityStandard",column = "quality_standard"),
                    @Result(property = "notNull",column = "not_null"),
                    @Result(property = "standardType",column = "standard_type"),
            }
    )
    List<DataManageStandardEntity> selectDataManageStandard();



    //根据标准类型查询详情
    @Select("SELECT * from  data_manage_standard WHERE standard_type = #{standardType}")
    @Results(
            id = "selectStandardTypeDetails",
            value = {
                    @Result(property = "fieldName",column = "field_name"),
                    @Result(property = "contentStandard",column = "content_standard"),
                    @Result(property = "qualityStandard",column = "quality_standard"),
                    @Result(property = "notNull",column = "not_null"),
                    @Result(property = "standardType",column = "standard_type"),
            })
    List<DataManageStandardEntity> selectStandardTypeDetail(@Param("standardType") String standardType);
}
